home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / bytmrk20.lha / nmglobal.h < prev    next >
C/C++ Source or Header  |  1995-11-03  |  11KB  |  469 lines

  1. /*
  2. ** BYTEmark (tm)
  3. ** BYTE Magazine
  4. */
  5.  
  6. /********************************************************
  7. ** GLOBAL DEFINITIONS FOR BOTH NBENCH0.C AND NBENCH1.C **
  8. ********************************************************/
  9.  
  10. /*
  11. ** SYSTEM DEFINES
  12. */
  13.  
  14. /* +++ MEMORY +++ */
  15.  
  16. /*
  17. ** You must define ONLY ONE of the following identifiers
  18. ** to specify the mechanism for allocating memory:
  19. ** MALLOCMEM
  20. ** DOS16MEM
  21. ** MACMEM
  22. */
  23.  
  24. /*
  25. ** Define MALLOCMEM to use the standard malloc() call for
  26. ** memory.  This is the default for most systems.
  27. */
  28. #define MALLOCMEM
  29.  
  30. /*
  31. ** Define DOS16MEM if you're running in the old 16-bit segmented
  32. ** model.  This enables some fruity memory management routines
  33. ** required for that model.  NOT defining this assumes that
  34. ** you're running in an environment that allows malloc() to
  35. ** get > 64K chunks of memory.
  36. */
  37. /* #define DOS16MEM */
  38.  
  39. /* Define MACMEM to use the Mac's GetPtr call to allocate
  40. ** memory (instead of malloc()).
  41. */
  42. /* #define MACMEM */
  43.  
  44. /* +++ TIMING +++ */
  45. /*
  46. ** You must define ONLY ONE of the following identifiers to pick
  47. ** the timing routine used.
  48. **  CLOCKWCPS
  49. **  CLOCKWCT
  50. **  MACTIMEMGR
  51. **  WIN31TIMER
  52. */
  53.  
  54. /*
  55. ** Define CLOCKWCPS if you are using the clock() routine and the
  56. ** constant used as the divisor to determine seconds is
  57. ** CLOCKS_PER_SEC.  This is the default in most cases.
  58. */
  59. #define CLOCKWCPS
  60.  
  61. /*
  62. ** Define CLOCKWCT if you are using the clock() routine and the
  63. ** constant used as the divisor to determine seconds is CLK_TCK
  64. */
  65. /* #define CLOCKWCT */
  66.  
  67. /*
  68. ** Define MACTIMEMGR to use the Mac Time manager routines.
  69. ** You'll need to be running at least system 6.0.3 or
  70. ** better...extended time manager is recommended (system 7 or
  71. ** better).
  72. */
  73. /* #define MACTIMEMGR */
  74.  
  75. /*
  76. ** Define WIN31TIMER to user the timing routines in TOOLHELP.DLL.
  77. ** Gets accuracy down to the millisecond.
  78. */
  79. /* #define WIN31TIMER */
  80.  
  81. /* +++ MISCELLANEOUS +++ */
  82.  
  83. /*
  84. ** Define DOS16 if you'll be compiling under DOS in 16-bit
  85. ** (non DOS-extended) mode.  This will enable proper definitions
  86. ** for the far*** typedefs
  87. */
  88. /* #define DOS16 */
  89.  
  90. /*
  91. ** Define MAC if you're compiling on a Macintosh.  This
  92. ** does a number of things:
  93. **  includes unix.h
  94. **  excludes mem.h
  95. **  Incorporates code to mimic the command line via either
  96. **      the console library (Symantec/Think) or the SIOUX
  97. **      library (Code Warrior).
  98. */
  99. /* #define MAC */
  100.  
  101. /*
  102. ** Define LONG64 if your compiler emits 64-bit longs.
  103. ** This is typically true of Alpha compilers on Unix
  104. ** systems...though, who knows?, this may change in the
  105. ** future.
  106. */
  107. /* #define LONG64 */
  108.  
  109. /*
  110. ** Define MACCWPROF if you are profiling on the Mac using
  111. ** Code Warrior.  This enables code that turns off the
  112. ** profiler in an evern of an error exit.
  113. */
  114. /* #define MACCWPROF */
  115.   
  116. #ifdef MAC
  117. #include <unix.h>
  118. #endif
  119.  
  120. /*
  121. ** ERROR CODES
  122. */
  123. #define ERROR_MEMORY    1
  124. #define ERROR_FILECREATE 10
  125. #define ERROR_FILEREAD 11
  126. #define ERROR_FILEWRITE 12
  127. #define ERROR_FILEOPEN 13
  128. #define ERROR_FILESEEK 14
  129.  
  130. /*
  131. ** MINIMUM_TICKS
  132. **
  133. ** This sets the default number of minimum ticks.
  134. ** It can, of course, be overridden by the input
  135. ** command file.
  136. ** This ultimately gets loaded into the variable
  137. ** global_min_ticks, which specifies the minimum
  138. ** number of ticks that must take place between
  139. ** a StartStopwatch() and StopStopwatch() call.
  140. ** The idea is to reduce error buildup.
  141. */
  142. #define MINIMUM_TICKS 60
  143.  
  144. /*
  145. ** MINIMUM_SECONDS
  146. **
  147. ** Minimum number of seconds to run each test.
  148. */
  149. #define MINIMUM_SECONDS 5
  150.  
  151. /*
  152. ** MAXPOSLONG
  153. **
  154. ** This is the maximum positive long.
  155. */
  156. #define MAXPOSLONG 0x7FFFFFFFL
  157.  
  158. /*
  159. ** OTHER DEFINES
  160. */
  161. #ifndef MAC
  162. #define TRUE    1
  163. #define FALSE   0
  164. #endif
  165.  
  166. /*
  167. ** TYPEDEFS
  168. */
  169. typedef unsigned char uchar;
  170. typedef unsigned int uint;
  171. typedef unsigned short ushort;
  172. typedef unsigned long ulong;
  173.  
  174. /*
  175. ** The 'farxxx' typedefs were added in deference to DOS, which
  176. ** requires far pointers to handle some of the bigger
  177. ** memory structures.  Other systems will simply
  178. ** map 'farxxx' to 'xxx'
  179. */
  180. #ifdef DOS16
  181. typedef void huge farvoid;
  182. typedef double huge fardouble;
  183. typedef long huge farlong;
  184. typedef unsigned long huge farulong;
  185. typedef char huge farchar;
  186. typedef unsigned char huge faruchar;
  187.  
  188. #else
  189.  
  190. typedef void farvoid;
  191. typedef double fardouble;
  192. typedef long farlong;
  193. typedef unsigned long farulong;
  194. typedef char farchar;
  195. typedef unsigned char faruchar;
  196.  
  197. #endif
  198.  
  199. /*
  200. ** The following typedefs are used when element size
  201. ** is critical.  You'll have to alter these for
  202. ** your specifica platform/compiler.
  203. */
  204. typedef unsigned char u8;       /* Unsigned 8-bits */
  205. typedef unsigned short u16;     /* Unsigned 16 bits */
  206. typedef unsigned long u32;      /* Unsigned 32 bits */
  207.  
  208. /*****************
  209. ** NUMERIC SORT **
  210. *****************/
  211. /*
  212. ** DEFINES
  213. */
  214.  
  215. /*
  216. ** The following constant, NUMNUMARRAYS (no, it is not a
  217. ** Peter Sellers joke) is the maximum number of arrays
  218. ** that can be built by the numeric sorting benchmark
  219. ** before it gives up.  This maximum is dependent on the
  220. ** amount of memory in the system.
  221. */
  222. #define NUMNUMARRAYS    1000
  223.  
  224. /*
  225. ** The following constant NUMARRAYSIZE determines the
  226. ** default # of elements in each numeric array.  Ordinarily
  227. ** this is something you shouldn't fool with, though as
  228. ** with most of the constants here, it is adjustable.
  229. */
  230. #define NUMARRAYSIZE    8111L
  231.  
  232.  
  233. /*
  234. ** TYPEDEFS
  235. */
  236. typedef struct {
  237.         int adjust;             /* Set adjust code */
  238.         ulong request_secs;     /* # of seconds requested */
  239.         double sortspersec;     /* # of sort iterations per sec */
  240.         ushort numarrays;       /* # of arrays */
  241.         ulong arraysize;        /* # of elements in array */
  242. } SortStruct;
  243.  
  244. /****************
  245. ** STRING SORT **
  246. *****************
  247. ** Note: The string sort benchmark uses the same structure to
  248. ** communicate parameters as does the numeric sort benchmark.
  249. ** (i.e., SortStruct...see above.
  250. */
  251.  
  252. /*
  253. ** DEFINES
  254. */
  255. /*
  256. ** The following constant STRINGARRAYSIZE determines
  257. ** the default # of bytes allocated to each string array.
  258. ** Though the actual size can be pre-set from the command
  259. ** file, this constant should be left unchanged.
  260. */
  261. #define STRINGARRAYSIZE 8111L
  262.  
  263. /************************
  264. ** BITFIELD OPERATIONS **
  265. *************************
  266. */
  267.  
  268. /*
  269. ** DEFINES
  270. */
  271.  
  272. /*
  273. ** Following field sets the size of the bitfield array (in longs).
  274. */
  275. #ifdef LONG64
  276. #define BITFARRAYSIZE 16384L
  277. #else
  278. #define BITFARRAYSIZE 32768L
  279. #endif
  280.  
  281. /*
  282. ** TYPEDEFS
  283. */
  284. typedef struct {
  285.         int adjust;             /* Set adjust code */
  286.         ulong request_secs;     /* # of seconds requested */
  287.         double bitopspersec;    /* # of bitfield ops per sec */
  288.         ulong bitoparraysize;           /* Total # of bitfield ops */
  289.         ulong bitfieldarraysize;        /* Bit field array size */
  290. } BitOpStruct;
  291.  
  292. /****************************
  293. ** EMULATED FLOATING POINT **
  294. ****************************/
  295. /*
  296. ** DEFINES
  297. */
  298. #define INTERNAL_FPF_PRECISION 4
  299.  
  300. /*
  301. ** The following constant is the maximum number of loops
  302. ** of the emulated floating point test that the system
  303. ** will allow before flagging an error.  This is not a
  304. ** critical constant, and can be altered if your system is
  305. ** a real barn-burner.
  306. */
  307. #define CPUEMFLOATLOOPMAX 50000L
  308.  
  309. /*
  310. ** Set size of array
  311. */
  312. #define EMFARRAYSIZE 3000L
  313.  
  314. /*
  315. ** TYPEDEFS
  316. */
  317. typedef struct {
  318.         int adjust;             /* Set adjust code */
  319.         ulong request_secs;     /* # of seconds requested */
  320.         ulong arraysize;        /* Size of array */
  321.         ulong loops;            /* Loops per iterations */
  322.         double emflops;         /* Results */
  323. } EmFloatStruct;
  324.  
  325. /*************************
  326. ** FOURIER COEFFICIENTS **
  327. *************************/
  328.  
  329. /*
  330. ** TYPEDEFS
  331. */
  332. typedef struct {
  333.         int adjust;             /* Set adjust code */
  334.         ulong request_secs;     /* # of requested seconds */
  335.         ulong arraysize;        /* Size of coeff. arrays */
  336.         double fflops;          /* Results */
  337. } FourierStruct;
  338.  
  339. /*************************
  340. ** ASSIGNMENT ALGORITHM **
  341. *************************/
  342.  
  343. /*
  344. ** TYPEDEFS
  345. */
  346. typedef struct {
  347.         int adjust;             /* Set adjust code */
  348.         ulong request_secs;     /* Requested # of seconds */
  349.         ulong numarrays;        /* # of arrays */
  350.         double iterspersec;     /* Results */
  351. } AssignStruct;
  352.  
  353. /********************
  354. ** IDEA ENCRYPTION **
  355. ********************/
  356.  
  357. /*
  358. ** DEFINES
  359. */
  360. /* Following constant defines the max number of loops the
  361. ** system will attempt. Keeps things from going off into the
  362. ** weeds. */
  363. #define MAXIDEALOOPS 50000L
  364.  
  365. /*
  366. ** Following constant sets the size of the arrays.
  367. ** NOTE: For the IDEA algorithm to work properly, this
  368. **  number MUST be some multiple of 8.
  369. */
  370. #define IDEAARRAYSIZE 4000L
  371.  
  372. /*
  373. ** TYPEDEFS
  374. */
  375. typedef struct {
  376.         int adjust;             /* Set adjust code */
  377.         ulong request_secs;     /* Requested # of seconds */
  378.         ulong arraysize;        /* Size of array */
  379.         ulong loops;            /* # of times to convert */
  380.         double iterspersec;     /* Results */
  381. } IDEAStruct;
  382.  
  383.  
  384. /************************
  385. ** HUFFMAN COMPRESSION **
  386. ************************/
  387.  
  388. /*
  389. ** DEFINES
  390. */
  391. /*
  392. ** MAXHUFFLOOPS
  393. **
  394. ** This constant specifies the maximum number of Huffman
  395. ** compression loops the system will try for.  This keeps
  396. ** the test from going off into the weeds.  This is not
  397. ** a critical constant, and can be increased if your
  398. ** system is a real barn-burner.
  399. */
  400. #define MAXHUFFLOOPS 50000L
  401.  
  402. /*
  403. ** Following constant sets the size of the arrays to
  404. ** be compressed/uncompressed.
  405. */
  406. #define HUFFARRAYSIZE 5000L
  407.  
  408. /*
  409. ** TYPEDEFS
  410. */
  411.  
  412. typedef struct {
  413.         int adjust;             /* Set adjust code */
  414.         ulong request_secs;     /* Requested # of seconds */
  415.         ulong arraysize;        /* Size of array */
  416.         ulong loops;            /* # of times to compress/decompress */
  417.         double iterspersec;     /* Results */
  418. } HuffStruct;
  419.  
  420. /********************************
  421. ** BACK PROPAGATION NEURAL NET **
  422. ********************************/
  423.  
  424. /*
  425. **  MAXNNETLOOPS
  426. **
  427. ** This constant sets the max number of loops through the neural
  428. ** net that the system will attempt before giving up.  This
  429. ** is not a critical constant.  You can alter it if your system
  430. ** has sufficient horsepower.
  431. */
  432. #define MAXNNETLOOPS  50000L
  433.  
  434. /*
  435. ** TYPEDEFS
  436. */
  437. typedef struct {
  438.         int adjust;             /* Set adjust code */
  439.         ulong request_secs;     /* Requested # of seconds */
  440.         ulong loops;            /* # of times to learn */
  441.         double iterspersec;     /* Results */
  442. } NNetStruct;
  443.  
  444. /***********************
  445. **  LU DECOMPOSITION  **
  446. ** (Linear Equations) **
  447. ***********************/
  448.  
  449. /*
  450. ** MAXLUARRAYS
  451. **
  452. ** This sets the upper limit on the number of arrays
  453. ** that the benchmark will attempt to build before
  454. ** flagging an error.  It is not a critical constant, and
  455. ** may be increased if your system has the horsepower.
  456. */
  457. #define MAXLUARRAYS 1000
  458.  
  459. /*
  460. ** TYPEDEFS
  461. */
  462. typedef struct {
  463.         int adjust;             /* Set adjust code */
  464.         ulong request_secs;     /* Requested # of seconds */
  465.         ulong numarrays;        /* # of arrays */
  466.         double iterspersec;     /* Results */
  467. } LUStruct;
  468.  
  469.